﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PedesTrainProject.Data
{
    public class FileHandler
    {
        private bool autosave;
        private string path;
        private Serialiazer serializer;

        public FileHandler()
        {
            serializer = new Serialiazer();
        }

        public bool loadData()
        {
            return false;
        }

        public void saveGrid(Grid.Grid grid, string fileName)
        {
            serializer.SerializeGrid(fileName, grid);               
        }

        public Grid.Grid loadGrid(string fileName)
        {
            return serializer.DeSerializeGrid(fileName);
        }

        public void saveSimulation(Core.Simulation simulation, string fileName)
        {
            serializer.SerializeSimulation(fileName, simulation);
        }

        public Core.Simulation loadSimulation(string fileName)
        {
            return serializer.DeSerializeSimulation(fileName);
        }

        public void saveReport(Report report)
        {

        }

        public bool saveStatistics(string filename, List<Statistics> statistics)
        {
            try
            {
                serializer.SerializeStatistics(filename, statistics);
                return true;
            }
            catch
            {
                return false;
            }
        }

        public List<Statistics> loadStatistics(string filename)
        {
            return serializer.DeSerializeStatistics(filename);
        }
    }
}
